import { observable, action } from 'mobx-miniprogram'
import { syncGetStorage } from '@/utils/storage'

// 创建store对象
export const userStore = observable({
  token: syncGetStorage('token') || '',
  userInfo: syncGetStorage('userInfo') || {},

  setToken: action(function (data) {
    this.token = data
  }),
  setUserInfo: action(function (data) {
    this.userInfo = data
  })
})
